<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/allApp.css" />
		<link rel="stylesheet" href="css/css.css" />
		<style type="text/css">
			.title{
				margin: 0;
			}
			.xj-content .mui-card-content{
				padding: 2px 2px 14px 2px;
			}
			.img-up{
				margin-right:2.6%;
			}
			.fz13{
				font-size: 13px!important;
			}
			.fz15{
				font-size: 15px!important;
			}
			.mui-radio input[type=radio] {
				top: 3px!important;
			}
			.zdycomfirm {
				z-index: 1000000000000000;
				background-color: #FFFFFF;
				display: none;
				width: 80%;
				left: 10%;
				height: 200px;
				position: absolute;
				top: 30%;
				border-radius: 5px;
			}
			
			.zdytitle {
				height: 44px;
				line-height: 44px;
				color: #777777;
				text-align: center;
			}
			
			.zdycnt {
				height: 112px;
			}
			
			.zdybtn {
				display: flex;
			}
			
			.zdybtn div {
				width: 50%;
				height: 44px;
				line-height: 44px;
				text-align: center;
				color: #007aff;
			
			}
			
			.zdyquit {
				border-right: 1px solid #EFEFF4;
			}
			
			.mui-input-group .mui-input-row:after {
				height: 0px;
			}
			.hiden{
				display: none;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" >现场巡检</h1>
		</header>
		<div class="mui-content hiden">
			<!-- <div style="padding: 10px 10px 10px 18px ;margin-top: 10px; background-color: #ffffff;">巡检项：</div> -->
			<div class="xj-content" id="yulan">
				<div style="width: 100%;height: 0.5px;background-color: #c8c7cc;">
				</div>
				<!--<div class="mui-card">-->
				<!--页眉，放置标题-->
				<!--<div class="mui-card-header">
						<div class="mui-left">
							1 风机机位状况
						</div>
						<div class="mui-right mui-right-title">
							状态：<span>正常</span>
						</div>
					</div>-->
				<!--内容区-->
				<!--<div class="mui-card-content">
						<p>备注：表面无裂纹、无进水和积水、无塌陷</p>
						<div class="mui-row">
							
						
							<div class="img-up mui-pull-left">
								<img src="./img/img.png" alt="" />
							</div>
							<div class="img-up mui-pull-left">
								<img src="./img/img.png" alt="" />
							</div>
							<div class="img-up mui-pull-left">
								<img src="./img/img.png" alt="" />
							</div>
						</div>
					</div>
				</div>-->
				<!--<div class="mui-card">-->
				<!--页眉，放置标题-->
				<!--<div class="mui-card-header">
						<div class="mui-left">
							1 风机机位状况
						</div>
						<div class="mui-right mui-right-title">
							状态：<span class="FtHs">异常</span>
						</div>
					</div>-->
				<!--内容区-->
				<!--<div class="mui-card-content">
						<p>备注：表面无裂纹、无进水和积水、无塌陷</p>
						<div class="img-up">
							<img src="./img/img.png" alt="" />
						</div>
					</div>
				</div>-->

			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript" src="../../js/mkeyplus.base.xunjian.js"></script>
		<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../../js/common.js"></script>
		<script type="text/javascript" src="../../js/uuid.js"></script>
		<script src="./js/mui.previewimage.js"></script>
		<script src="./js/mui.zoom.js"></script>
		<script type="text/javascript" src="./js/img-up.js"></script>
		<script type="text/javascript">
			mui.init()
			mui.previewImage();
			
			// window.vm = new Vue({
			// 	el: "#container",
			// 	data: {
					
			// 	},
			// 	methods:{}
			// })
			var item;
			//遮罩初始化
			var checkValue = '';
			var _id = '';
			var type = '';
			
			mui.plusReady(function() {
				var self = plus.webview.currentWebview();
				_id = self._id;
				type = self.Type;
				var from = self.from;
				console.log('from='+from);
				item = self.item;
				
				var opener = self.opener();
				
				//			alert(_id);
//				var btn_state = self.btn_state;
					
				if(type=="2"){
					$('.mui-title').text('特殊巡检');
					special();
				}else{
					ajaxFunwei();
				}
				
				function special(){
					plus.nativeUI.showWaiting('列表加载中...');
					mui.baseApp.httpRequst('/api/v2/sbxj/findSpecialXj', {
							specialXjId: _id
						},
						function(data) {
							plus.nativeUI.closeWaiting();
							console.log("巡检项" + JSON.stringify(data));
							if(data.status == 200) {
								console.log("请求成功");
								var data = data.data;
								console.log("特殊巡检" + JSON.stringify(data))
									var str = "";
									str += '<div class="mui-card"data-id="' + data.specialXj.id + '">';
									str +='<div class="mui-card-content">'
									str +='<p>备注：<span class="beizhu">' + data.specialXj.remark + '</span></p>'
									str +='<div class="mui-row">'
									if(data.attachList == null){
									
									}else{
										var imgSrc=data.attachList;
										for(i=0;i<imgSrc.length;i++){
											str += '<div class="img-up mui-pull-left"><img src="' +Config.upurl+ imgSrc[i].attach + '" alt="" data-preview-src=""data-preview-group="1"/></div>';
//											<div class="photo mui-pull-left"data-id=""><img src="../../img/camera@3x.png"/><span class="mui-icon mui-icon-closeempty delete_"></span></div>
										}
										
									}
									str += '</div>';
									str += '</div>';
									str += '</div>';
									$(".xj-content").append(str);
								style_();

							} else if(data.data == 400) {
								mui.toast('密码不正确!');
							} else if(data.data == 409) {
								mui.toast('用户不存在!');
							}

						});
				}
				function ajaxFunwei() {
					plus.nativeUI.showWaiting('列表加载中...');
					mui.baseApp.httpRequst('/api/v2/sbxj/previewXjInfo', {
							id: _id
						},
						function(data) {
							plus.nativeUI.closeWaiting();
							console.log("巡检项" + JSON.stringify(data));
							if(data.status == 200) {
								console.log("请求成功");
								var data = data.data.jcxList;
								console.log("巡检预览" + JSON.stringify(data))
								for(var i = 0; i < data.length; i++) {
									var str = "";
									str += '<div class="mui-card"data-id="' + data[i].jcx_id + '">';
									if(data[i].status == "异常") {
										str += '<div class="mui-card-header"><div class="mui-left title fz15">'  + data[i].name + '</div><div class="mui-right mui-right-title">状态：<span class="FtHs">' + data[i].status + '</span></div></div>';
									} else {
										str += '<div class="mui-card-header"><div class="mui-left title fz15">' + data[i].name + '</div><div class="mui-right mui-right-title">状态：<span>' + data[i].status + '</span></div></div>';
									}
//									alert(data[i].image);
									if(data[i].image == null){
//										alert('111');
									str += '<div class="mui-card-content"><p class="fz13">备注：<span class="beizhu ">' + data[i].desc + '</span></p><div class="img-up hide"><img src="' +Config.upurl+ data[i].image + '" alt="" /></div></div>';
									}else{
//										alert('2222');
										str += '<div class="mui-card-content"><p class="fz13">备注：<span class="beizhu ">' + data[i].desc + '</span></p><div class="img-up"><img src="' +Config.upurl+ data[i].image + '" alt="" data-preview-src=""data-preview-group="'+(i+1)+'"/></div></div>';
									}
									str += '</div>';
									$(".xj-content").append(str);
								};
								$('.hiden').css('display','block')
								alert();
								style_();
								

							} else if(data.data == 400) {
								mui.toast('密码不正确!');
							} else if(data.data == 409) {
								mui.toast('用户不存在!');
							}

						});
						
				}
			})
			
			function alert(){
				$(".mui-card-header").on("tap", ".title", function() {
					var Text = $(this).text()
					mui.alert(Text, '巡检项名称', function() {});
				})
			}
			
			//			判断图片和备注改变样式
			function style_(){			
			var contentlist=$('.mui-card-content');
				for(var i=0;i<contentlist.length;i++){
//					var img_src=$(contentlist[i]).find('img').attr('src');
					
					var beizhu=$(contentlist[i]).find('.beizhu').text();
					/*alert(img_src);
					if(img_src==""){
						$(contentlist[i]).find('.img-up').addClass('hide');
						alert(beizhu);
					}*/
					if(beizhu==""){
						var beizhu=$(contentlist[i]).find('.beizhu').text('暂无备注');
					}
				}
			}
		</script>
	</body>

</html>